package loveqq.niceexcel.core.metadata;

import loveqq.niceexcel.annotation.Position;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;

/**
 * 跨行/列数据
 *
 * @author zhongjh@tsintergy.com
 * @date 2022-08-17
 */
@Getter
@Setter
@RequiredArgsConstructor
public class PositionData {
    /**
     * 第几块(从1开始)
     */
    private final int index;

    /**
     * 分块总数
     */
    private final int size;


    public static PositionData build(Position position) {
        if (position == null) {
            return null;
        }
        return new PositionData(position.index(), position.size());
    }

}
